package com.settlement.system.common.util.common;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * @author author
 */
public class CommonAcsUtil {

    public static String generateUUId() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    public static <T> List<List<T>> splitList(List<T> paramList, int pageSize) {
        if (pageSize > 1000) {
            pageSize = 1000;
        }
        List<List<T>> retList = new ArrayList<>();
        int size = paramList.size();
        int pageCount = (size / pageSize) + (size % pageSize > 0 ? 1 : 0);
        for (int pageNum = 1; pageNum <= pageCount; pageNum++) {
            int start = (pageNum - 1) * pageSize;
            int end = pageNum * pageSize > size ? size : pageNum * pageSize;
            retList.add(paramList.subList(start, end));
        }
        return retList;
    }
}
